<!DOCTYPE HTML>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>

<body>
<div>
javascript
<p>javascript</p>
<div>111</div>
<h5>PHP</h5>
</div>
<div>
哈哈哈
<p>javascript</p>
<div>
<div>444</div>
<div>333111</div>
<div>333111222</div>
<h5>PHP</h5>
</div>
<h5>PHP</h5>
</div>
<div>
哼哼
<p>javascript</p>
<div>555</div>
<h5>PHP</h5>
</div>
<script type="text/javascript">
var x = document.getElementsByTagName("div")[4].childNodes;
debugger
for (var i = 0; i < x.length; i++) {
    document.write("第" + (i + 1) + "个节点的值是：" + x[i].nodeValue + "<br  />");
    document.write("第" + (i + 1) + "个节点的名称是：" + x[i].nodeName + "<br  />");
    document.write("第" + (i + 1) + "个节点的属性是：" + x[i].nodeType + "<br  />");
    document.write("<br  />");
}
</script>
</body>

</html>